@import '../core/density/index';
@import '../core/theming/palette';
@import '../core/theming/theming';
@import '../core/theming/check-duplicate-styles';
@import '../core/typography/typography-utils';
@import  './tree-variables';

@mixin mat-tree-color($config-or-theme) {
  $config: mat-get-color-config($config-or-theme);
  $background: map-get($config, background);
  $foreground: map-get($config, foreground);

  .mat-tree {
    background: mat-color($background, 'card');
  }

  .mat-tree-node,
  .mat-nested-tree-node {
    color: mat-color($foreground, text);
  }
}

@mixin mat-tree-typography($config-or-theme) {
  $config: mat-get-typography-config($config-or-theme);
  .mat-tree {
    font-family: mat-font-family($config);
  }

  .mat-tree-node,
  .mat-nested-tree-node {
    font-weight: mat-font-weight($config, body-1);
    font-size: mat-font-size($config, body-1);
  }
}

@mixin _mat-tree-density($config-or-theme) {
  $density-scale: mat-get-density-config($config-or-theme);
  $height: _mat-density-prop-value($mat-tree-density-config, $density-scale, height);

  @include _mat-density-legacy-compatibility() {
    .mat-tree-node {
      min-height: $height;
    }
  }
}

@mixin mat-tree-theme($theme-or-color-config) {
  $theme: _mat-legacy-get-theme($theme-or-color-config);
  @include _mat-check-duplicate-theme-styles($theme, 'mat-tree') {
    $color: mat-get-color-config($theme);
    $density: mat-get-density-config($theme);
    $typography: mat-get-typography-config($theme);

    @if $color != null {
      @include mat-tree-color($color);
    }
    @if $density != null {
      @include _mat-tree-density($density);
    }
    @if $typography != null {
      @include mat-tree-typography($typography);
    }
  }
}

